<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="userForm" enctype="multipart/form-data">

                <br/>
                <h3 class="title">Atualizar Usuário</h3> <hr/>
                <p:growl id="messages" showDetail="false" autoUpdate="true" /> 

                <p:panel id="userPanel" styleClass="clearfix container_24 withoutBorder">
                    <fieldset>
                        <legend>Cadastro</legend>
                        <p:outputLabel value="Nome" styleClass="grid_3" for="nomeInputText"/>
                        <p:inputText id="nomeInputText" styleClass="grid_20" value="#{managerPesquisarUsuario.usuario.nome}" />

                        <p:outputLabel value="Cargo" styleClass="grid_3" for="cargoInputText"/>
                        <p:inputText id="cargoInputText" styleClass="grid_20" value="#{managerPesquisarUsuario.usuario.profissao}" />

                        <p:outputLabel value="E-mail" styleClass="grid_3" for="emailInputText"/>
                        <p:inputText id="emailInputText" styleClass="grid_20" value="#{managerPesquisarUsuario.usuario.email}" />
                    </fieldset>
                </p:panel>

                <p:panel id="loginPanel" styleClass="clearfix container_24 withoutBorder" 
                         rendered="#{managerPesquisarUsuario.habilitarEditarSenha}">
                    <fieldset>
                        <legend>Login</legend>
                        <p:outputLabel value="Login" styleClass="grid_3" for="loginInputText"/>
                        <p:inputText id="loginInputText" styleClass="grid_6" readonly="true"
                                     value="#{managerPesquisarUsuario.usuario.login}" />
                        <div class="clear"/>

                        <p:outputLabel value="Senha Atual" styleClass="grid_4 senhaLabelUsuario" for="passwordOldPassword"/>
                        <p:password id="passwordOldPassword" styleClass="grid_6" value="#{managerPesquisarUsuario.passwordOld}"
                                    required="true" 
                                    promptLabel="Digite uma senha segura" weakLabel="Razoável"
                                    goodLabel="Boa" strongLabel="Excelente" feedback="true"/>
                        <div class="clear"/>

                        <p:outputLabel value="Senha Nova" styleClass="grid_4 senhaLabelUsuario" for="passwordNewPassword"/>
                        <p:password id="passwordNewPassword" styleClass="grid_6" value="#{managerPesquisarUsuario.passwordNew}"
                                    required="true" 
                                    promptLabel="Digite uma senha segura" weakLabel="Razoável"
                                    goodLabel="Boa" strongLabel="Excelente" feedback="true"/>
                        <div class="clear"/>

                        <p:outputLabel value="Confirmar Senha" styleClass="grid_4 senhaLabelUsuario" for="confirmPassword"/>
                        <p:password id="confirmPassword" styleClass="grid_6" value="#{managerPesquisarUsuario.confirm}"
                                    required="true" 
                                    promptLabel="Digite uma senha segura" weakLabel="Razoável"
                                    goodLabel="Boa" strongLabel="Excelente" feedback="true"/>
                    </fieldset>
                </p:panel>

                <div class="buttonAction">
                    <p:commandButton value="Salvar" icon="ui-icon-disk"
                                     update="@form"
                                     actionListener="#{managerPesquisarUsuario.atualizar()}"
                                     styleClass="ui-priority-primary" />
                    <p:button href="pesquisarusuario.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                </div >

            </h:form>
        </ui:define>
    </ui:composition>

</html>
